# # a = -10
# #
# #
# # # python没有赋值表达式
# # # if a = 1:
# # #     pass
# # # print(a = 11)
# # # print( 20 if a>0 else 19)
# # #
# # # b = {'a':10,'c':30}
# # # print('a' in b)
# #
# # def demo(a, b, c):
# #     pass
# #
# #
# # # 函数参数个数
# # print(demo.__code__.co_argcount)
# #
# # print('/12'.strip('/'))
# #
# # from urllib.parse import parse_qs
# #
# # c = 'Id=123&type=test1%2Ctest2%2Ctest3&Date1=2018-03-25&Date2=2018-04-26'
# #
# # print(parse_qs(c))
# #
# # c = {'a': 5, 'b': 2}
# #
# #
# # # print(dict(sorted(c,key=lambda ab:c[ab])))
# #
# # def singleton(cls):
# #     instace = {}
# #
# #     def inner():
# #         if cls not in instace:
# #             obj = cls()
# #             instace[cls] = obj
# #             return obj
# #         return instace[cls]
# #
# #     return inner
# #
# #
# #
# # class Foo:
# #     _instance = None
# #
# #     def __new__(cls, *args, **kwargs):
# #         if cls._instance != None:
# #             return object.__new__(cls)
# #         return cls._instance
# #
# #
# #
# #
# # f1 = Foo()
# # f2 = Foo()
# # print(id(f1), id(f2))
#
# # # 元类
# # bar = type('Bar', (object,), {'name': '123', 'age': 123})
# #
# #
# # class XXX(type):
# #     # __metaclass__ = bar
# #     pass
# #
# #     def __new__(cls, *args, **kwargs):
# #         type.__new__(cls, 'xxx', (object,), {'name': 'alex', 'age': 50})
# #
# #
# # XXX
#
#
#
# # import datetime
# #
# # target=datetime.date(2017,8,1)
# # print(target)
# # # now=datetime.datetime.now().date()
# # # print(now)
# # res=datetime.date(2017,1,1)
# # print((target-res).days)
#
# class LNode:
#     print(123)
#     def __init__(self, elem):
#         self.elem = elem
#         self.pnext = None
#
#     def __str__(self):
#         return str(self.elem)
# def exitLoop(LList):
#     p1 = p2 = LList
#     while p2 and p2.pnext:  # 当链表为空或者只有一个结点时，就不执行循环体里的程序，返回False
#         p1 = p1.pnext
#         p2 = p2.pnext.pnext
#         print(p1,p2)
#         if p1 == p2:
#             return True
#     return False
#
#
# # if __name__ == "__main__":
#     # LList = LNode(1)
#     # p1 = LNode(2)
#     # p2 = LNode(3)
#     # p3 = LNode(4)
#     # p4 = LNode(5)
#     # p5 = LNode(6)
#     # LList.pnext = p1
#     # p1.pnext = p2
#     # p2.pnext = p3
#     # p3.pnext = p4
#     # p4.pnext = p5
#     # # p5.pnext = p2
#     # print(exitLoop(LList))
#     # a1={'a':1,'b':2}
#     # a2=dict(a=1,b=2)
#     # print(a1,a2)
#     # print(dir(a1))
#     # print(dir(a2))
#     # print(help(a1))
#     # a=1
#     # a1.__dict__={}
#     # print(a.__dict__)


def Singleton(cls):
    _instance = {}
    print('s')
    def _singleton(*args, **kargs):
        if cls not in _instance:
            _instance[cls] = cls(*args, **kargs)
            print(_instance)
        return _instance[cls]

    return _singleton


# @Singleton
# class A(object):
#     a = 1
#     print(a)
#
#     def __init__(self, x=0):
#         self.x = x
#         print(x)


# a1 = A(4)
# a2 = A(5)